/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Gleydson
 */
@Entity
@Table(name = "professor_reserva_rack")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ProfessorReservaRack.findAll", query = "SELECT p FROM ProfessorReservaRack p"),
    @NamedQuery(name = "ProfessorReservaRack.findByProfessor", query = "SELECT p FROM ProfessorReservaRack p WHERE p.professor = :professor")})
public class ProfessorReservaRack implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "professor")
    private String professor;
    @JoinColumn(name = "Rack_numero", referencedColumnName = "numero")
    @ManyToOne(optional = false)
    private Rack racknumero;
    @JoinColumn(name = "professor", referencedColumnName = "login", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Professor professor1;

    public ProfessorReservaRack() {
    }

    public ProfessorReservaRack(String professor) {
        this.professor = professor;
    }

    public String getProfessor() {
        return professor;
    }

    public void setProfessor(String professor) {
        this.professor = professor;
    }

    public Rack getRacknumero() {
        return racknumero;
    }

    public void setRacknumero(Rack racknumero) {
        this.racknumero = racknumero;
    }

    public Professor getProfessor1() {
        return professor1;
    }

    public void setProfessor1(Professor professor1) {
        this.professor1 = professor1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (professor != null ? professor.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProfessorReservaRack)) {
            return false;
        }
        ProfessorReservaRack other = (ProfessorReservaRack) object;
        if ((this.professor == null && other.professor != null) || (this.professor != null && !this.professor.equals(other.professor))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.ProfessorReservaRack[ professor=" + professor + " ]";
    }
    
}
